package com.xuecheng.content.mapper;

import com.xuecheng.content.model.dto.TeachplanDto;
import com.xuecheng.content.model.po.Teachplan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 课程计划 Mapper 接口
 * </p>
 *
 * @author itcast
 */
@Mapper
public interface TeachplanMapper extends BaseMapper<Teachplan> {

    /**
     * 查询某课程的课程计划，组成树型结构
     * @param courseId 课程id
     * @return List<TeachplanDto>
     */
    List<TeachplanDto> selectTreeNodes(@Param("courseId") long courseId);

    /**
     * 获取排序字段的最大值
     * @param courseId
     * @param parentid
     * @return
     */
    Integer getTeachplanMaxOrderId(@Param("courseId") long courseId,@Param("parentid") long parentid);

    /**
     * 课程计划上移或下移
     * @param move movedown表示向下移动，moveup表示向上移动
     * @param teachplanId
     */
    void moveTeachplan(@Param("move") String move,@Param("teachplanId") long teachplanId);
}
